package cn.getech.data.development.constant;

import lombok.Getter;

@Getter
public enum RangerMaskType {

    MASK_REDACT(1 , "MASK" ,"用x屏蔽所有字母字符，用n屏蔽所有数字字符。","用x和n替换字母和数字"),
    MASK_PARTIAL_LAST(2 , "MASK_SHOW_LAST_4","仅显示最后四个字符,其他用x代替。" ,"仅显示最后4个字符"),
    MASK_PARTIAL_FIRST(3 , "MASK_SHOW_FIRST_4" ,"仅显示前四个字符,其他用x代替。","仅显示前4个字符"),
    MASK_HASH(4 , "MASK_HASH" ,"用值的哈希值替换原值。(int类型的会转变成为null)","HASH"),
    MASK_NILLIFY(5 , "MASK_NULL" ,"用NULL值替换原值。","NULL"),
    MASK_UNMASKED(6 , "MASK_NONE" ,"原样显示","原样显示"),
    MASK_DATE(7 , "MASK_DATE_SHOW_YEAR" ,"仅显示日期字符串的年份部分，并将月份和日期默认为01/01。日期格式是DATE类型（yyyy-MM-dd）","仅显示日期年份"),
    MASK_CUSTOM(8 , "CUSTOM" ," 可使用任何有效Hive UDF(返回与被屏蔽的列中的数据类型相同的数据类型)来自定义策略。","自定义UDF");
    private  int id;
    private  String  name;
    private String desc;
    private String pageName;
    RangerMaskType(int id , String  name,String desc,String pageName){
        this.id = id;
        this.name = name;
        this.desc = desc;
        this.pageName = pageName;
    }

    public static RangerMaskType ObjOf(Integer status) {
        if (status == null) {
            return null;
        } else {
            for (RangerMaskType s : RangerMaskType.values()) {
                if (s.getId() == status) {
                    return s;
                }
            }
            return null;
        }
    }
}
